﻿using System;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Shapes;

using SpatialHashLib.Topology;

namespace SpatialHashLib
{
    public static class FrameworkElementExtensions
    {
        public static Extent GetExtent(this FrameworkElement element)
        {
            Coord p0 = new Coord( Canvas.GetLeft(element), Canvas.GetTop(element));
            Coord p1 = new Coord(p0.X + element.Width, p0.Y + element.Height);

            return new Extent(p0, p1);
        }

        public static Point GetPosition(this FrameworkElement element)
        {
            return new Point(Canvas.GetLeft(element), Canvas.GetTop(element));
        }

        //public static ISpatialKey SpatialKey(this Ellipse element)
        //{
        //    return SpatialKey((FrameworkElement)element);
        //}
    }
}
